package com.xtayfjpk.zookeeper.test.master_workers.callback;

import org.apache.zookeeper.AsyncCallback.StringCallback;
import org.apache.zookeeper.KeeperException.Code;

public class BaseStringCallback implements StringCallback {

	@Override
	public void processResult(int rc, String path, Object ctx, String name) {
		switch (Code.get(rc)) {
		case CONNECTIONLOSS:
			connectionLossCaseAction(rc, path, ctx, name);
			break;
		case OK:
			okCaseAction(rc, path, ctx, name);
			break;
		case NODEEXISTS:
			nodeExistsCaseAction(rc, path, ctx, name);
			break;
		default:
			defaultCaseAction(rc, path, ctx, name);
			break;
		}

	}
	
	protected void connectionLossCaseAction(int rc, String path, Object ctx, String name) {
		
	}
	protected void okCaseAction(int rc, String path, Object ctx, String name) {
		
	}
	protected void nodeExistsCaseAction(int rc, String path, Object ctx, String name) {
		
	}
	protected void defaultCaseAction(int rc, String path, Object ctx, String name) {
		
	}

}
